build: Use get_supported_link_arguments()
authorEmmanuele Bassi <ebassi@gnome.org>
Tue, 15 Dec 2020 11:19:39 +0000 (11:19 +0000)
committerEmmanuele Bassi <ebassi@gnome.org>
Tue, 15 Dec 2020 11:19:39 +0000 (11:19 +0000)
Instead of hand-coding it ourselves, let Meson deal with linker
arguments discovery.

meson.build

index f4a8e36f03d908fb121dfc17843e89612a19337e..dc34c09123f0058fa5b3437751a6e8109c277654 100644 (file)
@@ -319,15 +319,11 @@ if get_option('default_library') != 'static'
   endif
 endif
 
-common_ldflags = []
-
-if os_unix and not os_darwin
-  foreach ldflag: [ '-Wl,-Bsymbolic', '-Wl,-z,relro', '-Wl,-z,now', ]
-    if cc.links('int main () { return 0; }', name: ldflag, args: ldflag)
-      common_ldflags += [ ldflag ]
-    endif
-  endforeach
-endif
+common_ldflags = cc.get_supported_link_arguments([
+  '-Wl,-Bsymbolic',
+  '-Wl,-z,relro',
+  '-Wl,-z,now',
+])
 
 confinc = include_directories('.')
 gdkinc = include_directories('gdk')